package bud.mobile.dao;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import bud.vo.ChatDTO;
import bud.vo.CommentMemberDTO;
import bud.vo.CommentShopDTO;
import bud.vo.FriendDTO;
import bud.vo.MemberDTO;
import bud.vo.ShopDTO;

public class MobileMemberDaoiBatis extends SqlMapClientDaoSupport implements IMobileMemberDao{

	@Override
	public int insertMember(MemberDTO member) {
		return getSqlMapClientTemplate().update("Member.insertMember", member);
	}

	@Override
	public int deleteMember(MemberDTO member) {
		return getSqlMapClientTemplate().update("Member.deleteMember", member);
	}

	@Override
	public int updateMember(MemberDTO member) {
		return getSqlMapClientTemplate().update("Member.updateMember", member);
	}

	@Override
	public MemberDTO getMember(Integer mem_no) {
		return (MemberDTO)getSqlMapClientTemplate().queryForObject("Member.getMember", mem_no);
	}

	@Override
	public MemberDTO getMemberByEmail(String mem_email) {
		return (MemberDTO)getSqlMapClientTemplate().queryForObject("Member.getMemberByEmail", mem_email);
	}
	
	

	@Override
	public ShopDTO getShop(Integer sh_no) {
		return (ShopDTO)getSqlMapClientTemplate().queryForObject("Shop.getShop", sh_no);
	}

	@Override
	public List<ShopDTO> getShopList() {
		return (List<ShopDTO>)getSqlMapClientTemplate().queryForList("Shop.getShop");
	}

	
	
	@Override
	public List<CommentShopDTO> getCommentShop(int cs_ref_key) {
		return (List<CommentShopDTO>)getSqlMapClientTemplate().queryForList("Comment.getCommentShop", cs_ref_key);
	}

	@Override
	public int insertCommentShop(CommentShopDTO commentShop) {
		return getSqlMapClientTemplate().update("Comment.insertCommentShop", commentShop);
	}

	@Override
	public int deleteCommentShop(int cs_no) {
		return getSqlMapClientTemplate().update("Comment.deleteCommentShop", cs_no);
	}

	@Override
	public List<CommentMemberDTO> getCommentMember(int cm_ref_key) {
		return (List<CommentMemberDTO>)getSqlMapClientTemplate().queryForList("Comment.getCommentMember", cm_ref_key);
	}

	@Override
	public int insertCommentMember(CommentMemberDTO memberShop) {
		return getSqlMapClientTemplate().update("Comment.insertCommentMember", memberShop);
	}

	@Override
	public int deleteCommentMember(int cm_no) {
		return getSqlMapClientTemplate().update("Comment.deleteCommentMember", cm_no);
	}

	@Override
	public int insertFriend(FriendDTO friend) {
		return getSqlMapClientTemplate().update("Member.insertFriend", friend);
	}

	@Override
	public List<FriendDTO> getRequestFriendList(Integer mem_no) {
		return (List<FriendDTO>)getSqlMapClientTemplate().queryForList("Member.getRequestFriend", mem_no);
	}

	@Override
	public int updateFriend(FriendDTO friend) {
		return getSqlMapClientTemplate().update("Member.updateFriend", friend);
	}

	@Override
	public int deleteFriend(FriendDTO friend) {
		return getSqlMapClientTemplate().update("Member.deleteFriend", friend);
	}

	@Override
	public List<ChatDTO> getChat(ChatDTO chat) {
		return (List<ChatDTO>)getSqlMapClientTemplate().queryForList("Chat.getChat", chat);
	}

	@Override
	public int insertChat(ChatDTO chat) {
		return getSqlMapClientTemplate().update("Chat.insertChat", chat);
	}

	@Override
	public ChatDTO getRecentChat(ChatDTO chat) {
		return (ChatDTO)getSqlMapClientTemplate().queryForObject("Chat.getRecentChat", chat);
	}

	@Override
	public FriendDTO getIsRequestFriend(FriendDTO friend) {
		return (FriendDTO)getSqlMapClientTemplate().queryForObject("Member.getIsRequestFriend", friend);
	}



}
